package com.free.system.service.impl;

import java.util.List;
import com.free.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.free.system.mapper.FreeTicketMapper;
import com.free.system.domain.FreeTicket;
import com.free.system.service.IFreeTicketService;
import com.free.common.core.text.Convert;

/**
 * 票券Service业务层处理
 * 
 * @author Sophia
 * @date 2025-02-27
 */
@Service
public class FreeTicketServiceImpl implements IFreeTicketService 
{
    @Autowired
    private FreeTicketMapper freeTicketMapper;

    /**
     * 查询票券
     * 
     * @param id 票券主键
     * @return 票券
     */
    @Override
    public FreeTicket selectFreeTicketById(Long id)
    {
        return freeTicketMapper.selectFreeTicketById(id);
    }

    /**
     * 查询票券列表
     * 
     * @param freeTicket 票券
     * @return 票券
     */
    @Override
    public List<FreeTicket> selectFreeTicketList(FreeTicket freeTicket)
    {
        return freeTicketMapper.selectFreeTicketList(freeTicket);
    }

    /**
     * 新增票券
     * 
     * @param freeTicket 票券
     * @return 结果
     */
    @Override
    public int insertFreeTicket(FreeTicket freeTicket)
    {
        freeTicket.setCreateTime(DateUtils.getNowDate());
        return freeTicketMapper.insertFreeTicket(freeTicket);
    }

    /**
     * 修改票券
     * 
     * @param freeTicket 票券
     * @return 结果
     */
    @Override
    public int updateFreeTicket(FreeTicket freeTicket)
    {
        freeTicket.setUpdateTime(DateUtils.getNowDate());
        return freeTicketMapper.updateFreeTicket(freeTicket);
    }

    /**
     * 批量删除票券
     * 
     * @param ids 需要删除的票券主键
     * @return 结果
     */
    @Override
    public int deleteFreeTicketByIds(String ids)
    {
        return freeTicketMapper.deleteFreeTicketByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除票券信息
     * 
     * @param id 票券主键
     * @return 结果
     */
    @Override
    public int deleteFreeTicketById(Long id)
    {
        return freeTicketMapper.deleteFreeTicketById(id);
    }
}
